#include "stdafx.h"
#include "ckCheckElement.h"

namespace ck
{
	CheckElement::CheckElement()
	{
		m_nID = -1;
	}

	CheckElement::CheckElement(z_uint32 ID)
	{
		m_nID = ID;
	}

	CheckElement::~CheckElement()
	{
	}

	z_uint32 CheckElement::GetID()
	{
		return m_nID;
	}

	z_uint32 CheckElement::GetCode()
	{
		return m_nCode;
	}

	z_uint32 CheckElement::GetType()
	{
		return m_nType;
	}

	const char* CheckElement::GetCodeString()
	{
		return m_szCode;
	}

	const char* CheckElement::GetName()
	{
		return m_szName;
	}

	const char* CheckElement::GetEName()
	{
		return m_szEName;
	}

	const char* CheckElement::GetDescription()
	{
		return m_szDescription;
	}

	void CheckElement::SetCode(z_uint32 nCode)
	{
		m_nCode = nCode;
	}
	void CheckElement::SetType(z_uint32 nType)
	{
		m_nType = nType;
	}

	void CheckElement::SetCode(const char* szCode)
	{
		if (szCode)
		{
			strcpy(m_szCode, szCode);
		}
	}

	void CheckElement::SetName(const char* szName)
	{
		if (szName)
		{
			strcpy(m_szName, szName);
		}
	}

	void CheckElement::SetEName(const char* szEName)
	{
		if (szEName)
		{
			strcpy(m_szEName, szEName);
		}
	}

	void CheckElement::SetDescription(const char* szDescription)
	{
		if (szDescription)
		{
			strcpy(m_szDescription, szDescription);
		}
	}


	//////////////////////////////////////////////////////////////////////////
	void CheckElement::GetElementCode(char* szElementCode, size_t nSize, const char* szCode)
	{
		char szTemp[_MAX_FNAME];
		memset(szTemp, 0, _MAX_FNAME);
		strncpy(szTemp, szCode, 3);

		memset(szElementCode, 0, nSize);
		//snprintf(szElementCode, nSize, "%s-000-000", szTemp);
		snprintf(szElementCode, nSize, "%s", szTemp);

	}

	void CheckElement::GetSubElementCode(char* szSubElementCode, size_t nSize, const char* szCode)
	{
		char szTemp[_MAX_FNAME];
		memset(szTemp, 0, _MAX_FNAME);
		strncpy(szTemp, szCode, 7);

		memset(szSubElementCode, 0, nSize);
		//snprintf(szSubElementCode, nSize, "%s-000", szTemp);
		snprintf(szSubElementCode, nSize, "%s", szTemp);
	}

}
